package com.example.doubao_ai_demo.controller;

import com.example.doubao_ai_demo.constant.GlobalConstant;
import com.example.doubao_ai_demo.service.DouBaoAiService;
import com.volcengine.ark.runtime.model.completion.chat.ChatCompletionChoice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private DouBaoAiService douBaoAiService;

    @PostMapping("/ai_search")
    public List<ChatCompletionChoice> getSearchContent(@RequestParam Map<String, String> params) {

        return douBaoAiService.getSearchContent(params.get(GlobalConstant.PROMPT), params.get(GlobalConstant.INPUT));

    }

    @GetMapping("/sayHello")
    public String hello() {
        return "hello";
    }
}
